Repository navigation
Fix Google Scholar render failure with a CSL JSON bibliography - #15125
Merged
Merged
Conversation
With google-scholar enabled and a CSL JSON bibliography (a .json file, the format Zotero exports as "CSL JSON"), rendering a document that cites anything failed with "JSON parse error: Error in $: mempty". renderToCSLJSON converts each bibliography with `pandoc <file> -t csljson` and lets pandoc guess the input format. For a .json input pandoc picks its own JSON AST reader, not CSL JSON. When pandoc processes a bibliography itself (citeproc), it maps .json to CSL JSON, so the visible bibliography rendered fine and only the Scholar metadata step broke. Passing `-f csljson` for .json files matches that mapping. BibTeX and CSL YAML bibliographies already worked. The failure is old (the conversion is unchanged since v1.4) and reaches both the per-page Scholar tags and the book references page regeneration.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
2 of 5 tasks
cderv
added a commit
that referenced
this pull request
Oct 20, 2026
A YAML bibliography not wrapped in --- delimiters produced no
citation_reference tags with google-scholar enabled, so its references
were missing from the Scholar output. Pandoc has no reader for YAML
bibliographies, so the file was read as markdown, which only finds
references in a delimited metadata block. Read .yaml and .yml files the
way --bibliography does, from the first YAML document:
- A references: map goes through --metadata-file, so Pandoc's YAML
reader handles it unchanged.
- A top-level list is wrapped as {references: ...} on stdin, since
--metadata-file needs a map.
- The shape check accepts any YAML tag and keeps the last value of a
duplicate key, as Pandoc does, so delimited files that worked before
still do.
See #15125 for the CSL JSON case of the same conversion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
google-scholar: trueand a CSL JSON bibliography (bibliography: references.json), rendering a document that cites anything fails with:Found while working on Google Scholar reference metadata in #15118. The same document renders fine without
google-scholar, and BibTeX and CSL YAML bibliographies work with it.The Scholar metadata converts each bibliography with
pandoc <file> -t csljsonand lets Pandoc guess the input format from the extension. For.json, Pandoc picks its own JSON AST reader, not CSL JSON. Pandoc citeproc reads a.jsonbibliography as CSL JSON, so the fix passes-f csljsonfor.jsonfiles to match. This covers both the per-page tags and the book references page, which use the same conversion.Not a regression, this conversion has been the same since at least v1.4.
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.